fix(slack): use event.ts as threadTs fallback for DMs#292
Open
chechunhsu wants to merge 1 commit intovercel:mainfrom
Open
fix(slack): use event.ts as threadTs fallback for DMs#292chechunhsu wants to merge 1 commit intovercel:mainfrom
chechunhsu wants to merge 1 commit intovercel:mainfrom
Conversation
Fixes vercel#268 When handling DM messages, threadTs was set to empty string when event.thread_ts was undefined. This caused invalid_thread_ts errors from the Slack API when streaming responses. The fix uses event.ts as fallback consistently for all message types.
Contributor
|
@chechunhsu is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #268
When handling DM (direct message) events, the Slack adapter set
threadTsto an empty string whenevent.thread_tswas undefined:This caused
invalid_thread_tserrors from the Slack API when attempting to stream responses back to DMs viachatStream.The fix uses
event.tsas the fallback for all message types:This ensures the bot replies in a thread under the original DM message, matching the behavior for channel messages.
Behavioral Note
This changes how top-level DM messages interact with
openDM()subscriptions:slack:CHANNEL:(empty threadTs), which exactly matchedopenDM()subscription IDs → messages routed toonSubscribedMessage()slack:CHANNEL:event.ts→ messages now route toonNewMention()instead ofonSubscribedMessage()Apps using
openDM()and relying on exact subscription matching should be aware of this change. Messages are still delivered correctly — only the routing handler changes.Test plan
invalid_thread_tserror in a production deploymentpnpm validatepasses cleanly